package oop.ex3.crosswords;
/**
 * 
 * @author yossavi
 *
 */
public class CrosswordLetter {

	private char letter=' ';
	private int overlap=0;
	
	/**
	 * 
	 * @param letter
	 */
	public CrosswordLetter(char letter) {
		this.letter = letter;
		this.overlap = 1;
	}
	
	/**
	 * 
	 * @param letter
	 */
	public CrosswordLetter(CrosswordLetter letter) {
		this.letter = letter.getLetter();
		this.overlap = letter.getOverlap();
	}
	
	/**
	 * 
	 * @return
	 */
	public char getLetter() {
		return letter;
	}
	
	/**
	 * 
	 * @param letter
	 */
	public void setLetter(char letter) {
		this.letter = letter;
		assert (letter==this.letter);
		if (letter!=' ')
			this.overlap++;
		else 
			this.overlap=0;
	}
	
	/**
	 * 
	 * @return
	 */
	public int getOverlap() {
		return overlap;
	}
	
	/**
	 * 
	 */
	public void lowerOverlap() {
		this.overlap--;
		if (this.overlap==0)
			this.letter=' ';
	}
	
	
}
